home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / igc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.3 KB  |  96 lines

  1. /* Copyright (C) 1994, 1995, 1996, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: igc.h,v 1.2 2000/09/19 19:00:44 lpd Exp $ */
  20. /* Internal interfaces in Ghostscript GC */
  21.  
  22. #ifndef igc_INCLUDED
  23. #  define igc_INCLUDED
  24.  
  25. #include "istruct.h"
  26.  
  27. /* Declare the vm_reclaim procedure for the real GC. */
  28. extern vm_reclaim_proc(gs_gc_reclaim);
  29.  
  30. /* Define the procedures shared among a "genus" of structures. */
  31. /* Currently there are only two genera: refs, and all other structures. */
  32. struct struct_shared_procs_s {
  33.  
  34.     /* Clear the relocation information in an object. */
  35.  
  36. #define gc_proc_clear_reloc(proc)\
  37.   void proc(P2(obj_header_t *pre, uint size))
  38.     gc_proc_clear_reloc((*clear_reloc));
  39.  
  40.     /* Compute any internal relocation for a marked object. */
  41.     /* Return true if the object should be kept. */
  42.     /* The reloc argument shouldn't be required, */
  43.     /* but we need it for ref objects. */
  44.  
  45. #define gc_proc_set_reloc(proc)\
  46.   bool proc(P3(obj_header_t *pre, uint reloc, uint size))
  47.     gc_proc_set_reloc((*set_reloc));
  48.  
  49.     /* Compact an object. */
  50.  
  51. #define gc_proc_compact(proc)\
  52.   void proc(P3(obj_header_t *pre, obj_header_t *dpre, uint size))
  53.     gc_proc_compact((*compact));
  54.  
  55. };
  56.  
  57. /* Define the structure for holding GC state. */
  58. /*typedef struct gc_state_s gc_state_t; *//* in gsstruct.h */
  59. #ifndef name_table_DEFINED
  60. #  define name_table_DEFINED
  61. typedef struct name_table_s name_table;
  62. #endif
  63. struct gc_state_s {
  64.     const gc_procs_with_refs_t *procs;    /* must be first */
  65.     chunk_locator_t loc;
  66.     vm_spaces spaces;
  67.     int min_collect;        /* avm_space */
  68.     bool relocating_untraced;    /* if true, we're relocating */
  69.     /* pointers from untraced spaces */
  70.     gs_raw_memory_t *heap;    /* for extending mark stack */
  71.     name_table *ntable;        /* (implicitly referenced by names) */
  72. };
  73.  
  74. /* Exported by igcref.c for igc.c */
  75. ptr_proc_unmark(ptr_ref_unmark);
  76. ptr_proc_mark(ptr_ref_mark);
  77. /*ref_packed *gs_reloc_ref_ptr(P2(const ref_packed *, gc_state_t *)); */
  78.  
  79. /* Exported by ilocate.c for igc.c */
  80. void ialloc_validate_memory(P2(const gs_ref_memory_t *, gc_state_t *));
  81. void ialloc_validate_chunk(P2(const chunk_t *, gc_state_t *));
  82. void ialloc_validate_object(P3(const obj_header_t *, const chunk_t *,
  83.                    gc_state_t *));
  84.  
  85. /* Macro for returning a relocated pointer */
  86. const void *print_reloc_proc(P3(const void *obj, const char *cname,
  87.                 const void *robj));
  88. #ifdef DEBUG
  89. #  define print_reloc(obj, cname, nobj)\
  90.     (gs_debug_c('9') ? print_reloc_proc(obj, cname, nobj) : nobj)
  91. #else
  92. #  define print_reloc(obj, cname, nobj) (nobj)
  93. #endif
  94.  
  95. #endif /* igc_INCLUDED */
  96.